#include <iostream>

using namespace std;

int main()
{
	const int limit = 99999;
	int sievearr[limit];
	int primenumbers[limit];
	int primepos = 0;
	int step;
	for (int i = 2; i < limit+2; i++)
		sievearr[i-2] = i;
	for (int i = 0; i < limit; i++)
	{
		if (sievearr[i] == 0)
			continue;
		step = sievearr[i];
		for (int x = i+step; x < limit; x += step)
		{
			if (sievearr[x] != 0)
				sievearr[x] = 0;
		}
	}
	for (int i = 0; i < limit; i++)
	{
		if (sievearr[i] != 0)
		{
			primenumbers[primepos] = sievearr[i];
			primepos++;
		}
	}
	cout << primenumbers[primepos-1] << endl;
	return 0;
}